#define __key_c

#include    "includeAll.h"

void GetKey()
{
    
    static uint8_t index=0;
    
    for(index=0;index<D_keyCount;index++){
        if(backUp[index]!=keySta[index])
        {
            if(backUp[index]!=0)
            {
                keyValue=index+1;
				holdKeyValue=keyValue;
				//keyValueNum++;
            }
		
		
		
        backUp[index]=keySta[index];
		
        }
		//加减同按显示温度
		if((backUp[1]==0)&&(backUp[2]==0))
		{
			bKeyTemp=1;
		}
		else
		{
			bKeyTemp=0;
		}
		//finish
		
		
    }
		//长按功能
		if((backUp[holdKeyValue-1]==keySta[holdKeyValue-1])&&(backUp[holdKeyValue-1]==0))
		{
			  if(longKeyJudgeTime>=25)
            {
                longKeyJudgeTime=0;
                longKeyValue=holdKeyValue;

            }
		
		}
		else
        {
            longKeyValue=0;
            longKeyJudgeTime=0;
        }
		//finish
		
	if(keyValueNum>1)//只能单按键
	{
		keyValueNum=0;
		keyValue=0;
	}
}

void KeyJudge()
{
    static uint8_t index;
    F_setKeyMode() ;
	
    keyBuf[0]=(keyBuf[0]<<1)|D_keyGongNeng;
    keyBuf[1]=(keyBuf[1]<<1)|D_keyJian;
    keyBuf[2]=(keyBuf[2]<<1)|D_keyJia;
    keyBuf[3]=(keyBuf[3]<<1)|D_keyQueRen;
  
    
    for(index=0;index<D_keyCount;index++)
    {
        if((keyBuf[index]&0xff)==0)
        {
            keySta[index]=0;
        }
        else if((keyBuf[index]&0xff)==0xff)
        {
            keySta[index]=1;
        }
    }
	F_setKeyMode();
}